#include <iostream>
#include <list>

using namespace std;

struct MyStruct
{
	MyStruct()
	{
		cout << "MyStruct()" << endl;
	}

	~MyStruct()
	{
		cout << "~MyStruct()" << endl;
	}

	int _i = 12;
	char _c = 'a';
};

//delete和delete[]
void test1()
{
	//char* str = new char[10] {'1', '2'};
	//delete[] str;

	//int* pi = new int(10);
	////delete[] pi;

	//int* pa = new int[10] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
	//delete[] pa;
	MyStruct* pa = new MyStruct[10];

	cout << *((long long*)pa - 1) << endl;

	delete[] pa;
}

class point
{
public:
  //explicit point(int x, int y)
	point(int x, int y)
		:_x(x), _y(y)
	{
		cout << "point" << endl;
	}

	point(const point& p)
		:_x(p._x), _y(p._y)
	{
		cout << "point(const point& p)" << endl;
	}

	//~point()
	//{
	//	cout << "~point" << endl;
	//}

private:
	int _x;
	int _y;
};

void test3()
{
	point p1(1, 3); //调用构造函数
	//point p2 = { 1, 3 }; //多参数构造函数的隐式类型转换，直接调用构造函数
	point p3{ 1, 3 }; //构造 + 拷贝构造 -> 直接构造

	list<int> l { 1, 2, 3 }; //列表初始化 initializer_list
}


int main()
{
	//test1();
	//test2();
  test3();
	return 0;
}
